
//function Parameters(boxName, serverUrl, xmlTypes, webServiceUrl, applicationPath, filter, xslUrl, defaultFolder, browserControlPath, language, virtualPath, folderFilter)
function Parameters(boxName, serverUrl, xmlTypes, webServiceUrl, applicationPath, filter, defaultFolder, browserControlPath, language, virtualPath, folderFilter)
{
	var tabFilter;
	var myObject;
	var sFeatures;
	var tmp;
	
	this.boxName = boxName;
	this.serverUrl = serverUrl;
	this.xmlTypes = xmlTypes;
	this.webServiceUrl = webServiceUrl;
	this.applicationPath = applicationPath;
	this.controlPath = "/" + virtualPath + "/Tree/";
	//this.xslUrl = xslUrl;
	this.defaultFolder = defaultFolder;//.replace(/_/g, "\\");
	this.browserControlPath = browserControlPath;
	this.language = language;
	this.virtualPath = virtualPath;
	this.folderFilter = folderFilter;

	if(document.all[this.boxName].value == "")
	{
		this.directory = defaultFolder;//.replace(/_/g, "\\");
	}
	else
	{
		this.directory = document.all[this.boxName].value;
	}
	
	tabFilter = filter.split(',');
	//alert(filter);
	this.filter = "";
	for(i=0; i<tabFilter.length; i++)
	{
		//alert(tabFilter[i]);
		switch(tabFilter[i].replace(" ", ""))
		{
			case "Excel":
				this.filter += "Excel,.xls,.xlt,.xlc,.xlm,.xlw:";
				break;
			case "Word":
				this.filter += "Word,.doc:";
				break;
			case "PowerPoint":
				this.filter += "PowerPoint,.ppt:";
				break;
			case "NotePad":
				this.filter += "Notepad,.txt,.log:";
				break;
			case "Image":
				this.filter += "Image,.jpg,.gif,.tif,.png,.bmp:";
				break;
			case "Acrobat":
				this.filter += "Acrobat,.pdf:";
				break;
			case "Archives":
				this.filter += "Archives,.zip,.rar,.ace:";
				break;
			case "All":
				this.filter += "All Files,*.*:";
				break;
			default:
				break;
		}
	}
	
	if (this.filter == "")
	{
		this.filter += "All Files,*.*:";
	}
	if(true)
	{
		this.filter = this.filter.substring(0, this.filter.length-1);
	}
	//alert(this.filter);
	this.xmlHttp = null;
	
	myObject = new Object();
	if(document.all[this.boxName].value == "")
	{
		myObject.directory = defaultFolder;//.replace(/_/g, "\\");
	}
	else
	{
		myObject.directory = document.all[this.boxName].value;
	}
	myObject.serverUrl = serverUrl;
	myObject.xmlTypes = xmlTypes;
	myObject.webServiceUrl = webServiceUrl;
	myObject.applicationPath = applicationPath;
	myObject.controlPath = "/" + virtualPath + "/Tree/";
	myObject.serverUrl = this.browserControlPath;
	myObject.filter = this.filter;
	//myObject.xslUrl = xslUrl;
	myObject.defaultFolder = defaultFolder;//.replace(/_/g, "\\");
	myObject.language = language;
	myObject.browserControlPath = browserControlPath;
	
	//alert("directory : " + this.directory.toLowerCase());
	//alert("default folder : " + this.defaultFolder.toLowerCase());
	var pos;
	pos = (this.directory.toLowerCase()).indexOf(this.defaultFolder.toLowerCase());
	if(pos == -1)
	{
		//alert(this.directory);
		//alert(this.defaultFolder);
		this.directory = defaultFolder;
		myObject.directory = defaultFolder;//.replace(/_/g, "\\");
		//alert("The Path specified does not contain default path Or is already a filepath!");
	}
	else
	{
		
		tmp = this.directory.substring(this.defaultFolder.length, this.directory.length);
		this.directory = this.defaultFolder + tmp;
		myObject.directory = this.directory;
	}
	
	sFeatures = "dialogHeight:500px;dialogWidth:600px;scroll:no;resizable:no;status:no;";
	//document.all["askedDir"].value = window.showModalDialog(myObject.serverUrl + applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + encodeURIComponent(this.xslUrl) + "&defaultFolder=" + encodeURIComponent(this.defaultFolder) + "&browserControlPath=" + encodeURIComponent(this.browserControlPath), myObject, sFeatures);
	tmp = defaultFolder;//.replace(/\\/g, "_");
	this.defaultFolder = tmp;
	//alert("directory sent : " + this.directory);
	//alert(this.defaultFolder);
	//alert(this.serverUrl + this.applicationPath + this.browserControlPath);
	/*this.folderFilter = "f";
	alert(this.xslUrl);
	alert(this.xmlTypes);
	alert(this.webServiceUrl);
	alert(this.directory);
	alert(this.applicationPath);
	alert(this.defaultFolder);
	alert(this.browserControlPath);
	alert(this.folderFilter);*/
	//document.all[this.boxName].value = window.showModalDialog(this.serverUrl + this.applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + encodeURIComponent(this.xslUrl) +"&defaultFolder="+ encodeURIComponent(this.defaultFolder) +"&browserControlPath="+ encodeURIComponent(this.browserControlPath) + "&folderFilter=" + encodeURIComponent(this.folderFilter), myObject, sFeatures);
	//alert(this.serverUrl + this.applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + "&defaultFolder="+ encodeURIComponent(this.defaultFolder) +"&browserControlPath="+ encodeURIComponent(this.browserControlPath) + "&folderFilter=" + encodeURIComponent(this.folderFilter));
	document.all[this.boxName].value = window.showModalDialog(this.serverUrl + this.applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + "&defaultFolder="+ encodeURIComponent(this.defaultFolder) +"&browserControlPath="+ encodeURIComponent(this.browserControlPath) + "&folderFilter=" + encodeURIComponent(this.folderFilter), myObject, sFeatures);
	
}

Parameters.prototype.Initialize = function()
{
	try
	{
		this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		err(e);
		this.xmlHttp = null;
	}
}